package io.renren.modules.ht.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.ht.dao.ContractsRelDao;
import io.renren.modules.ht.entity.ContractsRelEntity;
import io.renren.modules.ht.service.ContractsRelService;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("contractsRelService")
public class ContractsRelServiceImpl extends ServiceImpl<ContractsRelDao, ContractsRelEntity> implements ContractsRelService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<ContractsRelEntity> wrapper = new QueryWrapper<>();
        if(params.get("contractId")!=null){
            wrapper.eq("contract_id",params.get("contractId"));
        }
        IPage<ContractsRelEntity> page = this.page(
                new Query<ContractsRelEntity>().getPage(params),
                wrapper.orderByDesc("update_time")
        );

        return new PageUtils(page);
    }

}